#include "TransformComponent.h"


TransformComponent::TransformComponent(void) 
	:
mPos(0.f,0.f,0.f),
mScale(1.f,1.f,1.f),
mRot(),
mTransformMat(),
mDirty(false)
{
}


TransformComponent::~TransformComponent(void)
{
}

const Matrix& TransformComponent::GetConstMatrixTransform ()
{
	if(mDirty)
	{
		Matrix tMat;
		mRot.SetTransformationMatrix(tMat.mLineMat);

		mTransformMat = Matrix::NewTranslationMatrix(mPos) * tMat * Matrix::NewScaleMatrix(mScale);
		mDirty = false;
	}

	return mTransformMat;
}

Matrix TransformComponent::GetMatrixTransformForRender ()
{
	GetConstMatrixTransform ();
	return mTransformMat.Transpose();
}

Matrix TransformComponent::GetCopyMatrixTransform ()
{
	return GetConstMatrixTransform(); // will returns a copy
}